package com.demo.csrf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Controller
public class TestController {

    @RequestMapping("a")
    @ResponseBody
    public String a(HttpServletRequest request) {
        request.getSession(true).setAttribute("abc","abc");
        System.out.println("a");
        return "a";
    }

    @GetMapping("b.html")
    public String b() {
        System.out.println("b");
        return "b";
    }

}
